{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "8beb11d1",
   "metadata": {},
   "outputs": [],
   "source": [
    "import pandas as pd"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 37,
   "id": "fd48568e",
   "metadata": {},
   "outputs": [],
   "source": [
    "student_msg = {\n",
    "    \"考试科目\":[\"数学(150分制)\",\"语文(150分制)\",\"英语(150分制)\",\"物理(100分制)\",\"化学(100分制)\"],\n",
    "    \"小明1的成绩\":[135,110,120,95,91],\n",
    "    \"小明2的成绩\":[135,110,120,95,91],\n",
    "    \"小明3的成绩\":[135,110,120,95,91],\n",
    "    \"小明4的成绩\":[135,110,120,95,91],\n",
    "}"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 38,
   "id": "99202991",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>考试科目</th>\n",
       "      <th>小明1的成绩</th>\n",
       "      <th>小明2的成绩</th>\n",
       "      <th>小明3的成绩</th>\n",
       "      <th>小明4的成绩</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>数学(150分制)</td>\n",
       "      <td>135</td>\n",
       "      <td>135</td>\n",
       "      <td>135</td>\n",
       "      <td>135</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>语文(150分制)</td>\n",
       "      <td>110</td>\n",
       "      <td>110</td>\n",
       "      <td>110</td>\n",
       "      <td>110</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>英语(150分制)</td>\n",
       "      <td>120</td>\n",
       "      <td>120</td>\n",
       "      <td>120</td>\n",
       "      <td>120</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>物理(100分制)</td>\n",
       "      <td>95</td>\n",
       "      <td>95</td>\n",
       "      <td>95</td>\n",
       "      <td>95</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>化学(100分制)</td>\n",
       "      <td>91</td>\n",
       "      <td>91</td>\n",
       "      <td>91</td>\n",
       "      <td>91</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "        考试科目  小明1的成绩  小明2的成绩  小明3的成绩  小明4的成绩\n",
       "0  数学(150分制)     135     135     135     135\n",
       "1  语文(150分制)     110     110     110     110\n",
       "2  英语(150分制)     120     120     120     120\n",
       "3  物理(100分制)      95      95      95      95\n",
       "4  化学(100分制)      91      91      91      91"
      ]
     },
     "execution_count": 38,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df = pd.DataFrame(data = student_msg)\n",
    "df"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 39,
   "id": "84ef2186",
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": 40,
   "id": "46d5133b",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>姓名</th>\n",
       "      <th>数学</th>\n",
       "      <th>语文</th>\n",
       "      <th>英语</th>\n",
       "      <th>物理</th>\n",
       "      <th>化学</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>小明1的成绩</td>\n",
       "      <td>135</td>\n",
       "      <td>110</td>\n",
       "      <td>120</td>\n",
       "      <td>95</td>\n",
       "      <td>91</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>小明2的成绩</td>\n",
       "      <td>135</td>\n",
       "      <td>110</td>\n",
       "      <td>120</td>\n",
       "      <td>95</td>\n",
       "      <td>91</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>小明3的成绩</td>\n",
       "      <td>135</td>\n",
       "      <td>110</td>\n",
       "      <td>120</td>\n",
       "      <td>95</td>\n",
       "      <td>91</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>小明4的成绩</td>\n",
       "      <td>135</td>\n",
       "      <td>110</td>\n",
       "      <td>120</td>\n",
       "      <td>95</td>\n",
       "      <td>91</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>小明5的成绩</td>\n",
       "      <td>135</td>\n",
       "      <td>110</td>\n",
       "      <td>120</td>\n",
       "      <td>95</td>\n",
       "      <td>91</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>小明6的成绩</td>\n",
       "      <td>135</td>\n",
       "      <td>110</td>\n",
       "      <td>120</td>\n",
       "      <td>95</td>\n",
       "      <td>91</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "       姓名   数学   语文   英语  物理  化学\n",
       "0  小明1的成绩  135  110  120  95  91\n",
       "1  小明2的成绩  135  110  120  95  91\n",
       "2  小明3的成绩  135  110  120  95  91\n",
       "3  小明4的成绩  135  110  120  95  91\n",
       "4  小明5的成绩  135  110  120  95  91\n",
       "5  小明6的成绩  135  110  120  95  91"
      ]
     },
     "execution_count": 40,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df = pd.read_excel(\"gaokao.xls\")\n",
    "df"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 46,
   "id": "3e9c3987",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "135"
      ]
     },
     "execution_count": 46,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df[\"数学\"][5]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "2e4347d4",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.9.2"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
